import Vue from "vue";
import Router from "vue-router";
// import home from "./main/home.vue"
import login from "./login/login.vue";

Vue.use(Router);

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
const r = new Router({
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/login",
      name: "login",
      component: login,
    },
    {
      path: "/home/",
      name: "home",
      component: (resolve) =>
        require.ensure(
          [],
          () => {
            resolve(require("./main/home.vue"));
          },
          "employment"
        ),
      children: [
        {
          path: "dashboard",
          name: "dashboard",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/dashboard/index.vue"));
              },
              "dashboard"
            ),
          children: [
            {
              path: "",
              name: "homePage", // 概览首页
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/home/index.vue"));
                  },
                  "homePage"
                ),
            },
            {
              path: "iosStatistics",
              name: "iosStatistics", // IOS平台扣费统计
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/iosStatistics/index.vue")
                    );
                  },
                  "iosStatistics"
                ),
            },
            {
              path: "videoStatistics",
              name: "videoStatistics", // 活动奖励积分
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/videoStatistics/index.vue")
                    );
                  },
                  "videoStatistics"
                ),
            },
            {
              path: "punish",
              name: "punish", // 平台处罚
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/punish/index.vue"));
                  },
                  "punish"
                ),
            },
            {
              path: "compensate",
              name: "compensate", // 抵充处罚
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/compensate/index.vue"));
                  },
                  "compensate"
                ),
            },
            {
              path: "bonusPoints/:id",
              name: "bonusPoints", //奖励积分
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/bonusPoints/index.vue"));
                  },
                  "bonusPoints"
                ),
            },
            {
              path: "totalUserPoints",
              name: "totalUserPoints", //用户积分总数
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/totalUserPoints/index.vue")
                    );
                  },
                  "totalUserPoints"
                ),
            },
            {
              path: "integralDetails/:id",
              name: "integralDetails", //用户积分总数
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/integralDetails/index.vue")
                    );
                  },
                  "integralDetails"
                ),
            },
            {
              path: "newMember/:startdate?/:enddate?",
              name: "newMember", // 用户注册
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/newMember/index.vue"));
                  },
                  "newMember"
                ),
            },
            {
              path: "newCompany/:startdate?/:enddate?",
              name: "newCompany", // 企业注册
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/newCompany/index.vue"));
                  },
                  "newCompany"
                ),
            },
            {
              path: "newScore/:startdate?/:enddate?",
              name: "newScore", // 新增积分
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/newScore/index.vue"));
                  },
                  "newScore"
                ),
            },
            {
              path: "rechargeAmount/:startdate?/:enddate?",
              name: "rechargeAmount", // 企业充值金额
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/rechargeAmount/index.vue")
                    );
                  },
                  "rechargeAmount"
                ),
            },
            {
              path: "hwScoreTotal/:startdate?/:enddate?",
              name: "hwScoreTotal", // 积分提现
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/hwScoreTotal/index.vue"));
                  },
                  "hwScoreTotal"
                ),
            },
            {
              path: "guaranteeNum/:startdate?/:enddate?",
              name: "guaranteeNum", // 入保障期人数列表
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/guaranteeNum/index.vue"));
                  },
                  "guaranteeNum"
                ),
            },
            {
              path: "guaranteeDimission/:startdate?/:enddate?",
              name: "guaranteeDimission", // 保障期内离职人数列表
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/guaranteeDimission/index.vue")
                    );
                  },
                  "guaranteeDimission"
                ),
            },
            {
              path: "guaranteeOfficial/:startdate?/:enddate?",
              name: "guaranteeOfficial", // 过保障期转正
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/guaranteeOfficial/index.vue")
                    );
                  },
                  "guaranteeOfficial"
                ),
            },
            {
              path: "totalAmount/:type",
              name: "totalAmount", // 企业未支付订单总金额/企业已支付订单总金额
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/dashboard/totalAmount/index.vue"));
                  },
                  "totalAmount"
                ),
            },
            {
              path: "platformEarnings",
              name: "platformEarnings", // 平台收入明细
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/totalAmount/platformEarnings.vue")
                    );
                  },
                  "platformEarnings"
                ),
            },

            {
              path: "enterprisesPay",
              name: "enterprisesPay", // 企业充值总金额
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/dashboard/totalAmount/enterprisesPay.vue")
                    );
                  },
                  "enterprisesPay"
                ),
            },
          ],
        },

        // 最大的那个页面    企业管理页面
        {
          path: "socical",
          name: "socical", // 企业管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/socical/socical.vue"));
              },
              "socical"
            ),
        },
        {
          path: "housemanager",
          name: "housemanager", // 企业管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/housemanager/index.vue"));
              },
              "housemanager"
            ),
        },

        {
          path: "entering",
          name: "entering", // 企业/岗位录入
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/entering/index.vue"));
              },
              "entering"
            ),
        },

        {
          path: "enteringaddcompany",
          name: "enteringaddcompany", // 企业/岗位录入
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/entering/addcompany.vue"));
              },
              "enteringaddcompany"
            ),
        },
        {
          path: "enteringaddposition",
          name: "enteringaddposition", // 企业/岗位录入
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/entering/addposition.vue"));
              },
              "enteringaddposition"
            ),
        },
        {
          path: "pgentering",
          name: "pgentering", // 企业/岗位录入
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/entering/pgindex.vue"));
              },
              "pgentering"
            ),
        },

        {
          path: "pgindexassistant",
          name: "pgindexassistant", // 企业/岗位录入副页面
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/entering/pgindexassistant.vue"));
              },
              "pgindexassistant"
            ),
        },
        {
          path: "contract",
          name: "contract", // 电子合同
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/contract/contract.vue"));
              },
              "contract"
            ),
        },
        {
          path: "member",
          name: "member", // 会员管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/member/index.vue"));
              },
              "member"
            ),
        },
        {
          path: "stores",
          name: "stores", // 发才网线下门店
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/stores/index.vue"));
              },
              "stores"
            ),
        },
        {
          path: "flexible",
          name: "flexible", // 灵活用工
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/flexible/index.vue"));
              },
              "flexible"
            ),
        },
        {
          path: "flexibleEmployment/:mark",
          name: "flexibleEmployment", // 灵活用工子模块
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/flexible/flexibleEmployment.vue"));
              },
              "flexibleEmployment"
            ),
        },

        {
          path: "wechatManager/:mark",
          name: "wechatManager", // 麟工科技公众号后台
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./flexbleAccount/wechatManager.vue"));
              },
              "wechatManager"
            ),
        },

        {
          path: "extensionSystem",
          name: "extensionSystem", // 推广模块
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/extensionsystem/index.vue"));
              },
              "extensionSystem"
            ),
        },

        {
          path: "employment",
          name: "employment", // 企业招聘人员
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/employment/index.vue"));
              },
              "employment"
            ),
          children: [
            {
              path: "",
              name: "employmentList", // 企业招聘人员列表
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/employmentList/index.vue")
                    );
                  },
                  "noInterview"
                ),
            },
            {
              path: "noInterview/:companyid",
              name: "noInterview", // 待面试人数
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/employment/noInterview/index.vue"));
                  },
                  "noInterview"
                ),
            },
            {
              path: "failInterview/:companyid",
              name: "failInterview", // 面试未通过
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/failInterview/index.vue")
                    );
                  },
                  "failInterview"
                ),
            },
            {
              path: "accepted/:companyid/:params",
              name: "accepted", // 已录用
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/employment/accepted/index.vue"));
                  },
                  "accepted"
                ),
            },
            {
              path: "guarantee/:companyid",
              name: "guarantee", // 满保障期
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/employment/guarantee/index.vue"));
                  },
                  "guarantee"
                ),
            },
            {
              path: "abnormalRecord/:companyid/:params",
              name: "abnormalRecord", // 异常记录
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/abnormalRecord/index.vue")
                    );
                  },
                  "abnormalRecord"
                ),
            },
            {
              path: "resumeDelivery/:companyid",
              name: "resumeDelivery", // 异常记录
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/resumeDelivery/index.vue")
                    );
                  },
                  "resumeDelivery"
                ),
            },
            {
              path: "recommendationNumber/:companyid",
              name: "recommendationNumber", // 异常记录
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/recommendationNumber/index.vue")
                    );
                  },
                  "recommendationNumber"
                ),
            },
            {
              path: "companyInvitation/:companyid",
              name: "companyInvitation", // 异常记录
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/employment/companyInvitation/index.vue")
                    );
                  },
                  "companyInvitation"
                ),
            },
          ],
        },
        {
          path: "company", // 财务管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/company/company.vue"));
              },
              "company"
            ),
        },
        {
          path: "banner",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/banner/banner.vue"));
              },
              "banner"
            ),
          children: [
            {
              path: "",
              name: "bannerList", // banner列表
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/banner/bannerList/index.vue"));
                  },
                  "bannerList"
                ),
            },
            {
              path: "bannerAdd/:manage",
              name: "bannerAdd", // banner新增/编辑
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/banner/add/add.vue"));
                  },
                  "bannerAdd"
                ),
            },
          ],
        },
        {
          path: "newest",
          name: "newest",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/newest/index.vue"));
              },
              "newest"
            ),
          children: [
            {
              path: "",
              name: "newestList", // 最新动态列表
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/newest/newestList/newest.vue"));
                  },
                  "newestList"
                ),
            },
            {
              path: "add",
              name: "newestAdd", // 最新动态新增/编辑
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/newest/add/add.vue"));
                  },
                  "newestAdd"
                ),
            },
          ],
        },
        {
          path: "feedback",
          name: "feedback", // 反馈与帮助管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/feedbackManage/index.vue"));
              },
              "feedback"
            ),
          meta: {
            keepAlive: true,
          },
          children: [
            {
              path: "",
              name: "FeedbackHome",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/feedbackManage/FeedbackHome/index.vue")
                    );
                  },
                  "FeedbackHome"
                ),
            },
            {
              path: "FeedbackDetails",
              name: "FeedbackDetails",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/feedbackManage/FeedbackDetails/FeedbackDetails.vue")
                    );
                  },
                  "FeedbackDetails"
                ),
            },
            {
              path: "detailed",
              name: "detailed",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/feedbackManage/detailed/detailed.vue")
                    );
                  },
                  "detailed"
                ),
            },
          ],
        },
        {
          path: "invoice",
          name: "invoice", // 开票管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/invoice/index.vue"));
              },
              "invoice"
            ),
        },
        {
          path: "abnormal",
          name: "abnormal", // 异常处理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/abnormal/index.vue"));
              },
              "abnormal"
            ),
        },
        {
          path: "systemManage",
          name: "systemManage", // 系统管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/systemManage/systemManage.vue"));
              },
              "systemManage"
            ),
        },
        {
          path: "franchiseeManagement",
          name: "franchiseeManagement", // 加盟商管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(
                  require("./main/franchiseeManagement/franchiseeManagement.vue")
                );
              },
              "franchiseeManagement"
            ),
        },
        {
          path: "Management",
          name: "Management", // 稿件管理
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/Management/Management.vue"));
              },
              "Management"
            ),
        },
        {
          path: "backlogList",
          name: "backlogList", // 待办事项
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/backlog/backlog.vue"));
              },
              "backlogList"
            ),
        },
        {
          path: "log",
          name: "log", // 日志
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/log/log.vue"));
              },
              "log"
            ),
          children: [
            {
              // path: 'logList',
              path: "",
              name: "logList",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/log/systemLogList/systemLogList.vue")
                    );
                  },
                  "logList"
                ),
            },
            {
              path: "systemlog/:type",
              name: "systemlog",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(require("./main/log/systemLog/systemLog.vue"));
                  },
                  "systemlog"
                ),
            },
            {
              path: "lowerBrickList/:type/:userid",
              name: "lowerBrickList",
              component: (resolve) =>
                require.ensure(
                  [],
                  () => {
                    resolve(
                      require("./main/log/lowerBrickList/lowerBrickList.vue")
                    );
                  },
                  "lowerBrickList"
                ),
            },
          ],
        },
        {
          path: "account",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./main/account/account.vue"));
              },
              "account"
            ),
        },

        /* 家政板块 */
        {
          //家政板块-概览
          path: "houseIndex",
          name: "houseIndex",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/index.vue"));
              },
              "houseIndex"
            ),
        },
        {
          //家政板块-线上门店管理
          path: "StoreManagement",
          name: "StoreManagement",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/StoreManagement.vue"));
              },
              "StoreManagement"
            ),
        },
        {
          //家政板块-雇主管理
          path: "employer",
          name: "employer",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/Employermanagement.vue"));
              },
              "employer"
            ),
        },
        {
          //家政板块-从业者管理
          path: "practitioner",
          name: "practitioner",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/Practitionermanagement.vue"));
              },
              "practitioner"
            ),
        },
        {
          //家政板块-岗位招聘管理
          path: "postrecruitmen",
          name: "postrecruitmen",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/postrecruitmen.vue"));
              },
              "postrecruitmen"
            ),
        },
        {
          //家政板块-岗位招聘管理-人员展示
          path: "personnel",
          name: "personnel",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/personnel.vue"));
              },
              "personnel"
            ),
        },
        {
          //家政板块-月子会所
          path: "Confinement",
          name: "Confinement",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/Confinement.vue"));
              },
              "Confinement"
            ),
        },
        //  {	//家政板块-雇主管理
        // path: "employer",
        // name: "employer",
        // component: resolve => require.ensure([],() => {
        //   resolve(require("./household/page/employer.vue"))
        // },"employer")
        //  },
        //  { //家政板块-家政从业者管理
        // path: "practitioner",
        // name: "practitioner",
        // component: resolve => require.ensure([],() => {
        // 	resolve(require("./household/page/practitioner.vue"))
        // },"practitioner")
        //  },
        {
          //家政板块-岗位招聘管理
          path: "enterprise",
          name: "enterprise",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/enterprise.vue"));
              },
              "enterprise"
            ),
        },
        {
          //家政板块-下级账户授权
          path: "warrant",
          name: "warrant",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/warrant.vue"));
              },
              "warrant"
            ),
        },
        {
          //家政板块-月子会所管理
          path: "clubManage",
          name: "clubManage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/clubManage.vue"));
              },
              "clubManage"
            ),
        },
        {
          //家政板块-家政网点管理
          path: "networkManage",
          name: "networkManage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/networkManage.vue"));
              },
              "networkManage"
            ),
        },
        {
          //家政板块-点评管理
          path: "comment",
          name: "comment",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./household/page/comment.vue"));
              },
              "comment"
            ),
        },

        /* 电话招聘板块 */
        {
          //电话招聘板块-电话招聘人员管理
          path: "personnelManage",
          name: "personnelManage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/personnelManage.vue"));
              },
              "personnelManage"
            ),
        },
        {
          //发才网灵活用工微信公众号管理后台
          path: "flexbleAccount",
          name: "flexbleAccount",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./flexbleAccount/index.vue"));
              },
              "flexbleAccount"
            ),
        },

        {
          //电话招聘板块-项目管理
          path: "projectManage",
          name: "projectManage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/projectManage.vue"));
              },
              "projectManage"
            ),
        },
        {
          //电话招聘板块-人才库
          path: "talentpPool",
          name: "talentpPool",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/talentpPool/index.vue"));
              },
              "talentpPool"
            ),
        },

        {
          //电话招聘板块-发才网人才库
          path: "fcwTelentPool",
          name: "fcwTelentPool",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/fcwTelentPool.vue"));
              },
              "fcwTelentPool"
            ),
        },
        {
          //电话招聘板块-电话招聘资料管理
          path: "materialsManage",
          name: "materialsManage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/materialsManage.vue"));
              },
              "materialsManage"
            ),
        },
        {
          //电话招聘板块-概览
          path: "overviewPage",
          name: "overviewPage",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/overviewPage.vue"));
              },
              "overviewPage"
            ),
        },
        {
          //电话招聘板块-概览子页面
          path: "overviewItem",
          name: "overviewItem",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/overviewItem.vue"));
              },
              "overviewPage"
            ),
        },
        {
          //电话招聘板块-回收处
          path: "recyclingOffice",
          name: "recyclingOffice",
          component: (resolve) =>
            require.ensure(
              [],
              () => {
                resolve(require("./telRecruit/pages/recyclingOffice.vue"));
              },
              "recyclingOffice"
            ),
        },
        // {
        //   path: 'employNum',
        //   name: 'employNum',
        //   component: resolve => require.ensure([], () => {
        //     resolve(require("./main/employNum/employNum.vue"))
        //   }, "employNum")
        // },
        // {
        //   path: 'employmentCompany',
        //   component: resolve => require.ensure([], () => {
        //     resolve(require("./main/employmentCompany/employmentCompany.vue"))
        //   }, "employmentCompany"),
        // }
      ],
    },
  ],
});

r.beforeEach((to, from, next) => {
  var backlog = {
    id: "13",
    url: "./assets/img/backlog.png",
    path: "/home/backlogList",
    powername: "待办事项",
  };
  var log = {
    id: "14",
    url: "./assets/img/log.png",
    path: "/home/log",
    powername: "日志",
  };
  var account = {
    path: "/home/account",
  };
  var accounts = {
    path: "/home/pgentering",
  };
  if (to.name === "login") {
    next();
  } else {
    let userid = localStorage.getItem("userid");
    if (userid) {
      // debugger
      // console.log(localStorage.getItem('userinfo'));
      let userinfo = JSON.parse(localStorage.getItem("userinfo"));
      let permisstions = userinfo.permisstions;
      if (userinfo.type == "backstage" && userinfo.grade != "30") {
        permisstions.push(backlog, log, account);
      } else if (userinfo.grade == 40) {
        permisstions.push(accounts);
      } else if (
        userinfo.type == "housekeep" ||
        userinfo.type == "telRecruit" ||
        userinfo.grade == "30"
      ) {
        permisstions.push(account);
      }
      let flag = false;
      permisstions.forEach((el) => {
        if (to.path.indexOf(el.path) > -1) {
          flag = true;
        }
      });
      if (
        (to.path === "/home/feedback/FeedbackDetails" &&
          (from.path === "/home/log/systemlog" ||
            from.path === "/home/log/backlogList")) ||
        to.path === "/home/Management"
      ) {
        flag = true;
      }
      next();
      return;
      // if (flag) {
      // 	console.log(1)
      // 	next();
      // 	return;
      // } else {
      // 	console.log(2)
      // 	r.push({
      // 		path: from.path
      // 	});
      // 	// alert("无效地址！");
      // 	return;
      // }
    } else {
      // debugger
      r.push({
        name: "login",
      });
    }
  }
});

export default r;
